翻訳と辞書
Words near each other
・ NLU
・ NLUUG
・ NLV
・ NLV Pharos
・ NLV Pole Star
・ NLW
・ NLW MS 20143A
・ NLW MS 24029A (Boston Manuscript)
・ NLW MS 733B Piers Plowman
・ NLW MS 735C Astronomy
・ NLWC
・ NLX
・ NLX (motherboard form factor)
・ NLZ
・ Nm
Nm (Unix)
・ NM Institute of Engineering and Technology
・ NM-2-AI
・ NM-2201
・ NM-E (comics)
・ NM135
・ NM142
・ NMA
・ Nmai Dzorn
・ Nmap
・ NMath
・ NMath Stats
・ NMB
・ NMB Bank Limited
・ NMB Bank Nepal


Dictionary Lists
翻訳と辞書 辞書検索 [ 開発暫定版 ]
スポンサード リンク

Nm (Unix) : ウィキペディア英語版
Nm (Unix)

The nm command ships with a number of later versions of Unix and similar operating systems. nm is used to examine binary files (including libraries, compiled object modules, shared-object files, and standalone executables) and to display the contents of those files, or meta information stored in them, specifically the symbol table. The output from nm distinguishes between various symbol types. For example, it differentiates between a function that is supplied by an object module and a function that is required by it. nm is used as an aid for debugging, to help resolve problems arising from name conflicts and C++ name mangling, and to validate other parts of the toolchain.
The GNU Project ships an implementation of nm as part of the GNU Binutils package.
==nm output sample==


/
*

* File name: test.c

* For C code compile with:

* gcc -c test.c

*

* For C++ code compile with:

* g++ -c test.cpp

*/
int global_var;
int global_var_init = 26;
static int static_var;
static int static_var_init = 25;
static int static_function()
int global_function(int p)
int global_function2()
#ifdef __cplusplus
extern "C"
#endif
void non_mangled_function()
int main(void)

If the previous code is compiled with the gcc C compiler, the output of the nm command is the following:
# nm test.o
0000000a T global_function
00000025 T global_function2
00000004 C global_var
00000000 D global_var_init
00000004 b local_static_var.1255
00000008 d local_static_var_init.1256
0000003b T main
00000036 T non_mangled_function
00000000 t static_function
00000000 b static_var
00000004 d static_var_init

When the C++ compiler is used, the output differs:

# nm test.o
0000000a T _Z15global_functioni
00000025 T _Z16global_function2v
00000004 b _ZL10static_var
00000000 t _ZL15static_functionv
00000004 d _ZL15static_var_init
00000008 b _ZZ15global_functioniE16local_static_var
00000008 d _ZZ15global_functioniE21local_static_var_init
U __gxx_personality_v0
00000000 B global_var
00000000 D global_var_init
0000003b T main
00000036 T non_mangled_function

The differences between the outputs also show an example of solving the name mangling problem by using extern "C" in C++ code.

抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)
ウィキペディアで「Nm (Unix)」の詳細全文を読む



スポンサード リンク
翻訳と辞書 : 翻訳のためのインターネットリソース

Copyright(C) kotoba.ne.jp 1997-2016. All Rights Reserved.